package HomeWork.Encoding_Decoding;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

public class CharCoding {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //encoding
        String data="a我b";
        //UTF-8
        byte[] by1=data.getBytes(StandardCharsets.UTF_8);
        //GBK
        byte[] by2=data.getBytes("UTF_32");
        //decoding

        //UTF-8
        String s1=new String(by1);
        System.out.println(s1);
        //UTF-8
        String s2=new String(by2);
        System.out.println(s2);
    }
}
